home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-9.10-netbook-remix-PL.iso / casper / filesystem.squashfs / var / lib / dpkg / info / python-newt.prerm < prev    next >
Text File  |  2009-09-25  |  1KB  |  51 lines

  1. #!/bin/sh
  2.  
  3. set -e
  4.  
  5. # Automatically added by dh_pycentral
  6. case "$1" in remove|upgrade)
  7.     pkgremove=y
  8. esac
  9. if [ -f /var/lib/pycentral/python-newt.pkgremove ] || [ -f /var/lib/pycentral/pkgremove ]; then
  10.     pkgremove=y
  11. fi
  12. if [ "$pkgremove" = y ]; then
  13. if which python >/dev/null 2>&1 && which pycentral >/dev/null 2>&1; then
  14.     pycentral pkgremove python-newt
  15. else
  16.     flist=$(tempfile)
  17.     slist=$(tempfile)
  18.     dpkg -L python-newt | tee $flist | \
  19.     while read n; do
  20.       case "$n" in
  21.         /usr/share/pyshared/*)
  22.           n2=${n#/usr/share/pyshared/*}
  23.           case "$n" in
  24.         *.py) echo "p $n";;
  25.         *) [ -d "$n" ] && echo "d $n2" || echo "f $n2"
  26.           esac
  27.           ;;
  28.         *) continue
  29.       esac
  30.     done > $slist
  31.     if [ -s $slist ]; then
  32.         for d in /usr/lib/python[0-9].[0-9]/????-packages; do
  33.         case "$d" in */python2.1/*|*/python2.2/*) continue; esac
  34.         while read t n; do
  35.             case "$t" in
  36.             p) rm -f $d/$n $d/${n}[co];;
  37.             d) rmdir $d/$n 2>/dev/null || true;;
  38.             *) rm -f $d/$n
  39.             esac
  40.         done < $slist
  41.         done
  42.     fi
  43.         awk '/\/usr\/share\/pyshared/ {next} /\.py$/ {print $0"c\n" $0"o"}' $flist \
  44.         | xargs -r rm -f >&2
  45.     rm -f $flist $slist
  46. fi
  47. rm -f /var/lib/pycentral/python-newt.pkgremove
  48. fi
  49. # End automatically added section
  50.  
  51.